#ifdef TARG_SW5
cc = sw5cc.old -host -O3 -msimd 
cc_slave = sw5cc.old  -O3 -msimd
#endif

#ifdef TARG_SW3
#cc = swcc -O3 #-OPT: unroll_times_max=1 #-msimd 
#cc_slave = sw3cc -O3 #-OPT: unroll_times_max=1# -msimd
#endif

SCHEDULER_INSTALL_PATH=$(DAG_HOME)/dag_task_scheduler

NAIIVE  = -D_NAIIVE_LAM
MAIN = -D_MAIN_MEM
EXTRA_FLAGS = -DSIZEX=1802 -DSIZEY=1802 -DBLKX=60 -DBLKY=60 #-D_PROFILING -DCHECK #-D_DMA_GET
#EXTRA_FLAGS += -DCHECK
EXTRA_FLAGS += -D_LDM_STACK
#EXTRA_FLAGS += -D_MALLOC
#EXTRA_FLAGS += -DM2S
#EXTRA_FLAGS += -DS2M
#EXTRA_FLAGS += -DSPLIT
CFLAGS = $(EXTRA_FLAGS)  -I${SCHEDULER_INSTALL_PATH}/include -L${SCHEDULER_INSTALL_PATH}/lib
LIBFLAGS =  -ldag_task_scheduler -lstdc++ -lm 

NAIIVE_OBJECT = 2d5p_master.o 2d5p_naiive.o
REUSE1_OBJECT = 2d5p_master.o 2d5p_reuse_1_1.o
REUSE2_OBJECT = 2d5p_master.o 2d5p_reuse_1_2.o
REUSE9_OBJECT = 2d5p_master.o 2d5p_reuse_9.o
REUSE7_OBJECT = 2d5p_master.o 2d5p_reuse_7.o


all: naiive reuse_1_1 reuse_1_2 

naiive:2d5p_master.o 2d5p_naiive.o 2d5p_naiive
reuse_1_1:2d5p_master.o 2d5p_reuse_1_1.o  2d5p_reuse_1_1
reuse_1_2:2d5p_master.o 2d5p_reuse_1_2.o  2d5p_reuse_1_2
reuse_9:2d5p_master.o 2d5p_reuse_9.o  2d5p_reuse_9
reuse_7:2d5p_master.o 2d5p_reuse_7.o  2d5p_reuse_7

2d5p_master.o: 2d5p_master.c
	$(cc) $(CFLAGS) -c  2d5p_master.c  $(LIBFLAGS)
2d5p_naiive.o:  2d5p_naiive.c
	$(cc_slave) $(CFLAGS) $(NAIIVE) -c 2d5p_naiive.c  $(LIBFLAGS)
2d5p_reuse_1_1.o: 2d5p_reuse_1_1.c
	$(cc_slave) $(CFLAGS)  -c 2d5p_reuse_1_1.c  $(LIBFLAGS)
2d5p_reuse_1_2.o: 2d5p_reuse_1_2.c
	$(cc_slave) $(CFLAGS)  -c 2d5p_reuse_1_2.c  $(LIBFLAGS)
2d5p_reuse_9.o:2d5p_reuse_9.c
	$(cc_slave) $(CFLAGS)  -c 2d5p_reuse_9.c  $(LIBFLAGS)
2d5p_reuse_7.o:2d5p_reuse_7.c
	$(cc_slave) $(CFLAGS)  -c 2d5p_reuse_7.c  $(LIBFLAGS)
2d5p_naiive:  $(NAIIVE_OBJECT) 
	$(cc_slave) -hybrid   $(CFLAGS)  -o 2d5p_naiive $(NAIIVE_OBJECT) $(LIBFLAGS) 
2d5p_reuse_1_1:  $(REUSE1_OBJECT) 
	$(cc_slave) -hybrid   $(CFLAGS)  -o 2d5p_reuse_1_1 $(REUSE1_OBJECT) $(LIBFLAGS) 
2d5p_reuse_1_2:  $(REUSE2_OBJECT)
	$(cc_slave) -hybrid   $(CFLAGS)  -o 2d5p_reuse_1_2 $(REUSE2_OBJECT) $(LIBFLAGS)
2d5p_reuse_9:  $(REUSE9_OBJECT)
	$(cc_slave) -hybrid   $(CFLAGS)  -o 2d5p_reuse_9 $(REUSE9_OBJECT) $(LIBFLAGS)
2d5p_reuse_7:  $(REUSE7_OBJECT)
	$(cc_slave) -hybrid   $(CFLAGS)  -o 2d5p_reuse_7 $(REUSE7_OBJECT) $(LIBFLAGS)
clean:
	@-rm -f *.o 2d5p_naiive 2d5p_reuse_1_1 2d5p_reuse_1_2 2d5p_reuse_9  2d5p_reuse_7

